import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;


public class AreaCode {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		String fileName = "/home/pjbarrio/Dataset/rawAreaCode";
		
		BufferedReader br = new BufferedReader(new FileReader(new File(fileName)));
		
		String line = br.readLine();
		
		System.setOut(new PrintStream(new File("/home/pjbarrio/workspace/PRDualRankReplication/AreaCodeCity")));
		
		while (line != null){
			
			String[] split = line.split(" # ");
			
			String state = split[0].trim();
			
			String[] areacodes = split[1].replace('*', ' ').trim().split("/");
			
			String[] cities = split[2].trim().split(",");
			
			for (int code = 0; code < areacodes.length; code++) {
				
				for (int city = 0; city < cities.length; city++) {
					
					System.out.println(state + " - " + cities[city] + " - " + areacodes[code]);
					
				}
				
			}
			
			line = br.readLine();
		}
		
		br.close();
	}

}
